<template>
  <j-modal title="详情" :width="900" :visible="visible" switchFullscreen @cancel="handleCancel" @ok="handleOk">
    <div class="box">
      <p><span>人员姓名：</span>{{ infoObj.name }}</p>
      <p><span>身份证号：</span>{{ infoObj.identification }}</p>
      <p><span>特殊人员类型：</span>{{ infoObj.specialPersonType == 1 ? '病重' : '精神疾病' }}</p>
      <p><span>申请管控免除类型：</span>{{ getControlExemptionType(infoObj.controlExemptionType) }}</p>
      <p><span>申请管控类型：</span>{{ infoObj.controlType == 1 ? '毛发检测' : '--' }}</p>
      <p><span>免打卡签到时间：</span>{{ infoObj.mdkStartTime }} ~ {{ infoObj.mdkEndTime }}</p>
      <p><span>免定期尿液检测时间：</span>{{ getStrTime(infoObj.mnjTime) }}</p>
      <p><span>免突击尿液检测时间：</span>{{ infoObj.mljStartTime }} ~ {{ infoObj.mljEndTime }}</p>
      <p><span>免定期访谈时间：</span>{{ getStrTime(infoObj.mdqftTime) }}</p>
      <p><span>毛发检测时间：</span>{{ getStrTime(infoObj.hairInspect) }}</p>
      <p><span>证明材料：</span><j-upload v-model="infoObj.supportMaterials"></j-upload></p>
    </div>
    <template slot="footer">
      <p style="text-align: left;">创建人：{{ infoObj.createBy }} <span style="margin-left:30px;">创建时间：{{ infoObj.createTime
          }}</span> </p>
    </template>
  </j-modal>
</template>
<script>
import * as specialApi from '@/api/sjsk/specialPopul.js'
export default {
  name: 'detailModal',
  data() {
    return {
      visible: false,
      infoObj: {},
    }
  },
  async created() {
  },
  methods: {
    show(record) {
      this.visible = true
      this.getDetail(record.id)
    },
    getDetail(id) {
      specialApi.viewPopulDetails({ id: id }).then(res => {
        if (res.success) {
          this.infoObj = res.result
        }
      })
    },
    onTabChange() {

    },
    getStrTime(text) {
      console.log(text)
      if (text != undefined || text != null) {
        let arr = text.split(';')
        let str = ""
        arr.forEach(item => {
          if (item != "") {
            let arr1 = item.split(',')
            str += arr1[0] + '~' + arr1[1] + ';  '
          }
        })
        return str;
      } else {
        return "--";
      }
    },
    getControlExemptionType(text) {
      if (text != undefined || text != null) {
        const texts1 = text && text.indexOf('1') != -1 ? '打卡签到；' : ''
        const texts2 = text && text.indexOf('2') != -1 ? '常规尿检；' : ''
        const texts3 = text && text.indexOf('3') != -1 ? '突击尿检；' : ''
        const texts4 = text && text.indexOf('4') != -1 ? '定期访谈' : ''
        const texts = texts1 + texts2 + texts3 + texts4
        return (texts)
      } else {
        return "--";
      }
    },
    handleCancel() {
      this.visible = false
    },
    handleOk() {
      this.visible = false
    }
  },
}
</script>
<style lang="less" scoped>
.box {
  span {
    display: inline-block;
    width: 180px;
    text-align: left;
  }
}

/deep/.ant-upload {
  display: none;
}

/deep/.ant-upload-list {
  position: absolute;
  left: 155px;
  top: -27px;
}

/deep/.anticon-paper-clip {
  display: none;
}
</style>
